﻿<MCard Class="mx-auto"
       Width="300">
    <MList>
        <MListItem>
            <MListItemIcon>
                <MIcon>mdi-home</MIcon>
            </MListItemIcon>

            <MListItemTitle>Home</MListItemTitle>
        </MListItem>

        <MListGroup @bind-Value="userExpanded" PrependIcon="mdi-account-circle">
            <ActivatorContent>
                <MListItemTitle>Users</MListItemTitle>
            </ActivatorContent>
            <ChildContent>
                <MListGroup @bind-Value="adminExpanded" NoAction SubGroup>
                    <ActivatorContent>
                        <MListItemContent>
                            <MListItemTitle>Admin</MListItemTitle>
                        </MListItemContent>
                    </ActivatorContent>
                    <ChildContent>
                        @foreach (var item in _admins)
                        {
                            <MListItem Link>
                                <MListItemTitle>@item.Text</MListItemTitle>

                                <MListItemIcon>
                                    <MIcon>@item.Icon</MIcon>
                                </MListItemIcon>
                            </MListItem>
                        }
                    </ChildContent>
                </MListGroup>

                <MListGroup NoAction
                            SubGroup>
                    <ActivatorContent>
                        <MListItemContent>
                            <MListItemTitle>Actions</MListItemTitle>
                        </MListItemContent>
                    </ActivatorContent>
                    <ChildContent>
                        @foreach (var item in _cruds)
                        {
                            <MListItem Link>
                                <MListItemTitle>@item.Text</MListItemTitle>

                                <MListItemIcon>
                                    <MIcon>@item.Icon</MIcon>
                                </MListItemIcon>
                            </MListItem>
                        }
                    </ChildContent>
                </MListGroup>
            </ChildContent>
        </MListGroup>
    </MList>
</MCard>

@code{
    readonly Item[] _admins = new Item[]
    {
       new Item { Text= "Management", Icon= "mdi-account-multiple-outline" },
       new Item { Text= "Settings", Icon= "mdi-cog-outline" }
    };

    readonly Item[] _cruds = new Item[]
    {
       new Item { Text= "Create", Icon= "mdi-plus-outline" },
       new Item { Text= "Read", Icon= "mdi-file-outline" },
       new Item { Text= "Update", Icon= "mdi-update" },
       new Item { Text= "Delete", Icon= "mdi-delete" }
    };

    bool userExpanded = true;
    bool adminExpanded = true;

    class Item
    {
        public string Text { get; set; }
        public string Icon { get; set; }
    }
}